# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-xiaomi-perseus
pkgdesc="Xiaomi Mi Mix 3"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="postmarketos-base mkbootimg linux-postmarketos-qcom-sdm845 soc-qcom-sdm845"
makedepends="devicepkg-dev"
source="deviceinfo rootston.ini"
subpackages="$pkgname-nonfree-firmware:nonfree_firmware $pkgname-phosh"

build() {
	devicepkg_build $startdir $pkgname
}

package() {
	devicepkg_package $startdir $pkgname
}

nonfree_firmware() {
	pkgdesc="Modem, WiFi and GPU Firmware"
	depends="firmware-xiaomi-perseus"
	mkdir "$subpkgdir"
}

phosh() {
	install_if="$pkgname=$pkgver-r$pkgrel phosh"
	install -Dm644 "$srcdir"/rootston.ini \
		"$subpkgdir"/etc/phosh/rootston.ini
}

sha512sums="
7ae11c2d425d17ea28132c42b6b297b9487482af8b6dfe1bbc3d2fcf9fc7a3261a98c09c5a3d7960f6dc031225d695ab27013dbcffb0b9785b868cc18e82db51  deviceinfo
035f97e328ff9f976b082e66b97f76036cdee9825f3022471c7c5d371291cc4b5bd5c18196cd49f4cd9ad6390abe691b506de3b221e3c122433d5620e3b3c4c9  rootston.ini
"
